﻿using System.Web;
using System.Web.Mvc;

namespace BusinessBingo.Web.Helpers
{
    public static class UrlHelperExtensions
    {
        public static string ApplicationRootPath(this UrlHelper urlHelper)
        {
            HttpRequestBase httpRequestBase = urlHelper.RequestContext.HttpContext.Request;
            string rootPath = string.Format("{0}://{1}{2}", httpRequestBase.Url.Scheme, httpRequestBase.Url.Authority, urlHelper.Content("~"));

            if (rootPath.EndsWith("/") == false) rootPath = rootPath + "/";

            return rootPath;
        }
    }
}